
#include "SoundList.h"
#include <iostream>

#include "audiere.h"
using namespace audiere;

AudioDevicePtr* device;
OutputStreamPtr* soundlist[MAX_SOUNDS];
int index_sound = 0 ;

int SOUNDLIST_GetNumber(void)
{
	return index_sound;
}

void SOUNDLIST_Init(void)
{
	device = new AudioDevicePtr(OpenDevice());
}

void SOUNDLIST_DeInit(void)
{
	int i = 0;

	for(i = 0 ; i < index_sound; ++i)
	{
		(*soundlist[i])->stop();
		delete(&soundlist[i]);
	}

	delete(&device);
}

int SOUNDLIST_Insert(char cad[])
{
	soundlist[index_sound++] = new OutputStreamPtr(OpenSound(*device, cad, false));
	return (index_sound-1);
}

void SOUNDLIST_Play(int sound)
{
	(*soundlist[sound])->play();
}